package com.lzy.canal.config;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashSet;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

@Data
@ToString
@EqualsAndHashCode
@ConfigurationProperties(prefix = "com.lzy.canal.client.property")
public class CanalClientProperty {

    /**
     * 是否开启canal组件,默认不开启
     */
    private Boolean enabled = false;


    private List<CanalProperty> properItems;

    /**
     * mysqlShare 配置
     * key mysql的数据库名称
     * String mysql 表名称配置
     */
    private ConcurrentHashMap<String, HashSet<String>> mysqlSchemaTables;

    @Data
    @ToString
    @EqualsAndHashCode
    public static class CanalProperty {

        /**
         * canal server 主机地址,提供IP地址既可
         */
        private String hostname;
        /**
         * 端口
         */
        private Integer port = 11111;
        /**
         * canal server 配置 instance 名称
         */
        private String destination;
        /**
         * 连接用户名
         */
        private String username = "canal";
        /**
         * 连接密码
         */
        private String password = "canalL1225s00!";
    }
}
